<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>登录</title>
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../css/app.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"><span>返回</span></a>
			<h1 class="mui-title" id="title">登录</h1>
		</header>
		<div class="mui-content">
			<form class="mui-input-group">
				<div class="mui-input-row" style="margin-top: 35px;vertical-align: center;">
					<input id='username' type="text" class="mui-input-clear mui-input" placeholder="请输入用户名" value="13333333333">
				</div>
				<div class="mui-input-row">
					<input id='password' type="password" class="mui-input-clear mui-input" placeholder="请输入密码" value="111111">
				</div>
				
			</form>
			<div class="mui-content-padded " style="margin-top: 35px;">
				<button id='login' class="mui-btn main-btn-block">登录</button>
			</div>
			</div>
		<p style="text-align: center; padding: 20px;">
			<button id='reg' class="mui-btn mui-btn-link" data-title="用户注册" style="font-size: 15px;">新用户注册</button>
			<!--<button id='forget' class="mui-btn mui-btn-link" data-title="忘记密码" style="font-size: 15px;">忘记密码</button>-->
		</p>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/app.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" charset="utf-8">
			mui.init();
			mui.plusReady(function () {
				var current = plus.webview.currentWebview();
				var srcwb=current.srcwb;
				
				// 登录
				document.getElementById("login").addEventListener('tap',function () {
					var username=document.getElementById("username").value;
					var password = document.getElementById("password").value;
					if (!username) {
						plus.nativeUI.toast('请填写用户名');
						return;
					}
					if (!password) {
						plus.nativeUI.toast('请填写密码');
					}
					user.login(username,password,function () {
						 // 通知来源页刷新信息(可能是个人中心、订单中心等), 源页需要自己显示
						mui.fire(plus.webview.getWebviewById(srcwb),'reload',{});
						mui.fire(plus.webview.getWebviewById('page/mycenter.html'),'reload',{})
						mui.fire(plus.webview.getWebviewById('/page/mycenter/userInfo.html'),'reload',{})
						current.close();
					});
				},false);
				
				// 注册
				document.getElementById("reg").addEventListener('tap',function () {
					openPage('register1.html','register1.html',{srcwb:srcwb});
				},false);
				
//				// 忘记密码
//				document.getElementById("forget").addEventListener('tap',function () {
//					openPage('findPassword.html','findPassword.html',{srcwb:srcwb});
//				},false);
//				showPage(current);
			});
		</script>
	</body>

</html>